/**
 * 
 */
$(document).ready(function() {
	
	var str = window.location.search;
	var strs = str.split("?")[1].split("&");
	var id = strs[0].split("=")[1];
	var classSum = strs[1].split("=")[1];
	var countSum = strs[2].split("=")[1];
	var priceSum = strs[3].split("=")[1];
	
	//alert("id = "+id+"      classSum = "+classSum+"      countSum="+countSum+"        priceSum="+priceSum);
	
	$('#buy').click(function(){
		var payment = $('#payment option:selected').val();//付款方式
		var delivery = $('#delivery option:selected').val();//收货方式
		if(id == "" || id == null){
			alert("请登录账号");
			window.location.href="UserLogin.jsp";
		}else{
			$.get(
				"order/initOrder",
				{"id":id,"classSum":classSum,"countSum":countSum,"priceSum":priceSum,"payment":payment,"delivery":delivery},
				function(){
					window.location.href="order.jsp";
				}
			)
			//window.location.href="initOrder?id="+id+"&classSum="+classSum+"&countSum="+countSum+"&priceSum="+priceSum+"&payment="+payment+"&delivery="+delivery;
		}
	});
	$("#returnCar").click(function(){

		window.parent.document.getElementById("leftIframe").src="type.jsp";
		history.back(-1);
	})
/*	$('#returnCar').click(function(){
		parent.location.href="UserLogin.jsp";
	});*/
});